package cn.itsource.ymcc.schuletask;

import cn.itsource.ymcc.service.IKillCourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class KillCoursePublish2Redis {

    @Autowired
    private IKillCourseService killCourseService ;

    //每天凌晨1点执行一次：0 0 23 * * ?
    //每天晚上，12点，发布秒杀课程到Redis
    @Scheduled(cron = "0/5 * * * * ?")
    public void publishKillCourse2Redis(){
        //log.info("定时发布课程");
        killCourseService.publishKillActivity();
    }


    //每天凌晨1点执行一次：0 0 23 * * ?
    @Scheduled(cron = "0/10 * * * * ?")
    public void removeKillCourseFromRedis(){
        //log.info("移除Redis过时的秒杀课程");
        //killCourseService.removeKillCourseFromRedis();
    }

}
